package net.butfly.bus.policy;

import net.butfly.albacore.exception.NotImplementedException;
import net.butfly.bus.config.Config;

public abstract class RouterBase implements Router {
	protected Config config;

	public RouterBase(Config config) {
		this.config = config;
	}

	public static Router createRouter(Config config) {
		try {
			return config.getRouterBean().getRouterClass().getConstructor(Config.class).newInstance(config);
		} catch (Throwable e) {
			return null;
		}
	}

	public String[] lookup(String code) {
		throw new NotImplementedException("Simplest router do not lookup in directory.");
	}

	public String lookup(String code, String[] nodeIDs) {
		throw new NotImplementedException("Simplest router do not lookup in nodes.");
	}
}
